package com.itheima.interceptors;

import org.apache.struts2.ServletActionContext;

import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.MethodFilterInterceptor;

public class Login extends MethodFilterInterceptor{

	@Override
	protected String doIntercept(ActionInvocation invocation) throws Exception {
		Object object = ServletActionContext.getRequest().getSession().getAttribute("user");
		if (object != null) {
			return invocation.invoke();
		}
		return "login";
	}

}
